package com.example.hospital.api.service.impl;

import com.example.hospital.api.db.dao.MessageDao;
import com.example.hospital.api.db.dao.MisUserDao;
import com.example.hospital.api.db.pojo.MessageEntity;
import com.example.hospital.api.service.MessageService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @author luojing
 * @date 2024/4/30 9:31
 */
@Service
public class MessageServiceImpl implements MessageService {
    @Resource
    private MessageDao messageDao;

    @Override
    public ArrayList<HashMap> searchAll() {
        ArrayList<HashMap> list = messageDao.searchAll();
        return list;
    }

    @Override
    @Transactional //添加事务注解
    public void insert(MessageEntity entity) {
        messageDao.insert(entity);
    }

    @Override
    public void deleteByIds(Integer[] ids) {
        messageDao.deleteByIds(ids);
    }

    @Override
    @Transactional
    public void update(Map param) {
        messageDao.update(param);
    }

    @Override
    public HashMap searchById(int id) {
        HashMap map = messageDao.searchById(id);
        return map;
    }
}
